﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace amigos_dropbox_gui
{
    public partial class IfaceConfiguracao : Form
    {
        public IfaceConfiguracao()
        {
            InitializeComponent();
        }

        private void sairToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void IfaceConfiguracao_Resize(object sender, EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {
                Hide();
            }
        }

        private void notifyIcon_DoubleClick(object sender, EventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
        }

        private void IfaceConfiguracao_Load(object sender, EventArgs e)
        {
            Language l = new Language();
            cmbIdioma.DataSource = l.ListIdiomas();
            cmbIdioma.DisplayMember = "Descricao";
            cmbIdioma.ValueMember = "Id";
            Idioma i = new Idioma();
            i.AjustaCultura(this, i.IdiomaDefault());
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                Idioma i = new Idioma();
                i.AlteraIdioma(cmbIdioma.SelectedValue.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            this.Close();
        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void configuraçãoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void cmbIdioma_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
    class Language
    {
        public string Id { get; set; }
        public string Descricao { get; set; }
        public List<Language> ListIdiomas()
        { 
            List<Language> list = new List<Language>();
            list.Add(new Language {Id = "pt-BR", Descricao="Português"});
            list.Add(new Language {Id = "en-US", Descricao="Inglês"});
            return list;
        }
    }
}
